package com.million.eduservice.controller.front;

import com.million.commonutils.R;
import com.million.eduservice.entity.EduCourse;
import com.million.eduservice.entity.EduTeacher;
import com.million.eduservice.service.EduCourseService;
import com.million.eduservice.service.EduTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: studyboy
 * @Date: 2022/4/1  11:52
 * 用来写前端接口
 */
@RestController
@RequestMapping("/eduservice/indexfront")
public class IndexFrontController {

    @Autowired
    private EduCourseService eduCourseService;

    @Autowired
    private EduTeacherService eduTeacherService;

    //根据id降序，查询前8条热门课程
    @GetMapping("selectHotCourse")
    public R selectHotCourse () {
        List<EduCourse> eduCourseList = eduCourseService.selectHotCourse();
        return R.ok().data("eduCourseList", eduCourseList);
    }

    //根据id降序，查询四个讲师
    @GetMapping("selectFourTeacher")
    public R selectFourTeacher () {
        List<EduTeacher> eduTeacherList = eduTeacherService.selectFourTeacher();
        return R.ok().data("eduTeacherList", eduTeacherList);
    }


}
